package org.tgcloud.group.repository;

import org.apache.ibatis.annotations.Param;
import org.tgcloud.group.entity.SysPermission;
import org.tgcloud.group.web.controller.dto.sys.SysMenuDTO;

import java.util.List;

public interface SysPermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SysPermission record);

    int insertSelective(SysPermission record);

    SysPermission selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SysPermission record);

    int updateByPrimaryKey(SysPermission record);

    int selectRoleIsPermissionByUserId(@Param("userId") Integer userId,
                                       @Param("permissions") String permissions);

    int selectRoleIsPermissionByBusiness(@Param("userId") Integer userId,
                                         @Param("permissions") String permissions);

    int selectUserIsPermissionByUserId(@Param("userId") Integer userId,
                                       @Param("permissions") String permissions);

    List<SysMenuDTO> selectLoginListByUserId(@Param("userId") int userId, @Param("roleId") Integer roleId);

    int selectIsPermissionByUserId(@Param("userId") int userId, @Param("permission") String permissions);

    List<SysMenuDTO> selectListByRoleId(@Param("roleId") int roleId);

    List<SysMenuDTO> selectListByUserId(@Param("userId") Integer userId, @Param("userType") Short userType);

    SysPermission selectMsgByPermission(@Param("permissions") String permissions);
}
